﻿using System;
using System.Windows;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Prism.UnityExtensions;
using Microsoft.Practices.Unity;

namespace TimeSplicer.App
{
    public class Bootstrapper : UnityBootstrapper
    {
        protected override DependencyObject CreateShell()
        {
            return new Shell();
        }

        protected override void InitializeShell()
        {
            Application.Current.MainWindow = (Shell)this.Shell;
            Application.Current.MainWindow.Show();
        }

        protected override void ConfigureModuleCatalog()
        {
            base.ConfigureModuleCatalog();

            var catalog = this.ModuleCatalog as ModuleCatalog;


            catalog.AddModule(typeof(TimeSplicerModule.TimeSplicerModule));
            catalog.AddModule(typeof(DeveloperModule.DeveloperModule));
            catalog.AddModule(typeof(HubModule.HubModule));
            catalog.AddModule(typeof(DashboardModule.DashboardModule));
            catalog.AddModule(typeof(NavigationModule.NavigationModule)); // may have add this one last
        }

        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();

            // add other objects into the container like the error logger
        }

        protected virtual void RegisterBootstrapperProvidedTypes()
        {
            // todo reguster instances
            
        }
    }
}
